package com.bunnyhsu.mapper;

import com.bunnyhsu.model.Suggest;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by xl on 2018/4/10.
 */
@Repository
public interface SuggestMapper {

    /**
     *  page为页数，number为需要搜索的条数
     *  @return 意见
     */
    List<Suggest> selectSuggest(@Param("page") int page,@Param("number") int number,@Param("state")int state);

    Integer selectCountOfSuggests(@Param("state") int state);


    List<Suggest> selectUnionSuggest(@Param("page") int page,@Param("number") int number,
                                     @Param("state1")int state1,@Param("state2")int state2);

    int updateSuggest(@Param("state") int state,@Param("type_id") int type_id,
                       @Param("reply")String reply,@Param("id")int id);

    List<Suggest> selectSuggestByDate(@Param("page") int page,@Param("number") int number,
                                      @Param("state")int state,@Param("up")String up,
                                      @Param("down")String down);
    Integer selectCountOfSuggestsByDate(@Param("state")int state,@Param("up")String up,
                                        @Param("down")String down);
    List<Suggest> selectUnionSuggestByDate(@Param("page") int page,@Param("number") int number,
                                           @Param("state1")int state1,@Param("state2")int state2,
                                           @Param("up")String up, @Param("down")String down);

    List<Suggest> selectUnionSuggestByDateAndType(@Param("page") int page,@Param("number") int number,
                                                  @Param("up")String up, @Param("state1")int state1,
                                                  @Param("state2")int state2, @Param("down")String down,
                                                  @Param("typeId")int typeId);
    Integer selectCountOfUnionSuggestsByDateAndType(@Param("state1")int state1, @Param("state2")int state2,
                                                    @Param("up")String up, @Param("down")String down,
                                                    @Param("typeId")int typeId);
    Integer insertSuggest(Suggest suggest);
    List<Suggest> getRepliedSuggestByCommitterId(@Param("user_id")String userId);
}
